﻿@model NK.Mvc3.Models.SaleDetail

@using (Html.BeginForm())
{
    if (ViewBag.SaleID != null)
    {
        Html.HiddenFor(model => model.SaleID, new { Value = ViewBag.SaleID, id = "hdStoreInputID" });
    }

    @Html.HiddenFor(model => model.ProductInfoID, new { id = "hdProductInfoID" })
    
    <div class="gridcell">
        @Html.TextBox("dtupdateBarCode", null, new
           {
               @class = "grid-textbox-text",
               onchange = "changeBarCode(this,'hdProductInfoID','dtupdatePOSDescription','CostSale')"
           })
        @Html.ValidationMessage("dtupdateBarCode")
        @Html.ValidationMessageFor(model => model.ProductInfoID)
        
    </div>
    <div class="gridcell text">
        @Html.TextBox("dtupdatePOSDescription", null, new { @class = "grid-textbox-text", disabled = "disabled" })
    </div>
    <div class="gridcell num">
        @Html.TextBoxFor(model => model.Quantity, new { @class = "grid-textbox-num" })
        @Html.ValidationMessageFor(model => model.Quantity)
    </div>
    <div class="gridcell money">
        @Html.TextBoxFor(model => model.CostSale, new { @class = "grid-textbox-num", disabled = "disabled" })
        @Html.HiddenFor(model => model.CostSale, new { id = "hdCostSale" })
        @Html.ValidationMessageFor(model => model.CostSale)
    </div>
    <div class="gridcell money">
        @Html.TextBoxFor(model => model.TotalCost, new { @class = "grid-textbox-num", disabled = "disabled" })
        @Html.HiddenFor(model => model.TotalCost, new {id = "hdTotalCost"})
        @Html.ValidationMessageFor(model => model.TotalCost)
    </div>  
    <div class="gridcell action">
        <input type="submit" value="Insert" />
    </div>
}

<script type="text/javascript">
    $(function () {
        //Using this script when the paritial form is loaded by ajax, to set the validate on
        $.validator.unobtrusive.parse('form');
     });
</script>